class MakeChaptersTreelike < ActiveRecord::Migration
  def self.up
    add_column :chapters, :parent_id, :integer


    chapter_relations = {}
    chapter_relations["Noxious effects"] = ["Harmful effect", "Harmful strains localities", "Toxicity"]
    chapter_relations["Taxonomy"] = ["Class", "Genus", "Species", "Author", "Year", "Basionym", "First description", "Present description", "Type locality", "Reference(s)", "Notes", "Synonym(s)", "List of synonyms", "Taxonomical remarks", "References"]
    chapter_relations["Identification"] = ["Key features", "Measurements", "Movement", "Food", "Ecological data", "Species description", "Similar species", "Reproduction", "List of basionyms"]
    chapter_relations["More information"] = ["General information", "Bloom information", "Dynamics of blooms (General information)", "Educational resource", "Fisheries closures (federal)", "HABCRA", "HABs in the news", "Links", "Monitoring", "Research", "Toxin detection (ELISA)", "Toxin detection (general info)", "Toxin detection (HPLC)", "Toxin detection (RBA)", "Toxin general information"]
    #Next step is to say that the keys are the parents of each of the values
  end

  def self.down
    remove_column :chapters, :parent_id
  end
end
